<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>RF24 Library for 16 bit PIC MCUs: rf_spi.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">RF24 Library for 16 bit PIC MCUs
   </div>
   <div id="projectbrief">This library aims to provide PIC24 and dsPIC users an easy way to interface with the popular RF24 series chips from Nordic Semiconductor. It was developed originally as a direct port of maniacbug&#39;s Arduino RF24 library, but I went beyond that in order to increase speed for my application. The end result is a fast and easy to use library that leverages the improved speed and peripheral features present in 16 bit PIC MCUs.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">rf_spi.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="rf__spi_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;xc.h&gt;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;stdbool.h&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#ifndef SPI_H</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#define SPI_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#ifdef  __cplusplus</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">// this isn&#39;t necessary at all for the RF library but maybe I&#39;ll expand</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">// on this some day.</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> {SPI_8BIT = 0, SPI_16BIT = 1} SPI_MODE;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="keywordtype">void</span> <a class="code" href="rf__spi_8h.html#a35736310ee6ad14f2aa1bfa3d62c61dd">spi_init</a>(SPI_MODE mode, <span class="keyword">volatile</span> uint16_t* SS_REG, uint8_t SS_pin);</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;uint8_t <a class="code" href="rf__spi_8h.html#a021d3d71d7de4dde682dd55fbc0c2e71">spi_write8</a>(<span class="keyword">const</span> uint8_t byte);</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;uint16_t <a class="code" href="rf__spi_8h.html#af27e39df5f7f65da4878d5a3cfb1d830">spi_write16</a>(<span class="keyword">const</span> uint16_t word);</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="comment">// command byte included specifically for ease of use with the RF library</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">// ideally these would be generic but I&#39;m probably the only one that&#39;s</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="comment">// going to use this so it isn&#39;t a big deal</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="comment">// use these when you have one command byte and &gt;=2 data bytes</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;uint8_t <a class="code" href="rf__spi_8h.html#ae3f683d9d5b5d9542895dcbe0cb269b0">spi_write</a>(uint8_t command, <span class="keyword">const</span> uint8_t* buf, uint8_t len);</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;uint8_t <a class="code" href="rf__spi_8h.html#a098ee1e29d7d291d7d452729cccd7f51">spi_read</a>(uint8_t command, uint8_t nopChar, uint8_t* buf, uint8_t len);</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;uint8_t <a class="code" href="rf__spi_8h.html#afe4fa4827707bf89700f67434d84dd84">spi_write8_no_ss</a>(<span class="keyword">const</span> uint8_t byte);</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;uint8_t <a class="code" href="rf__spi_8h.html#a3a40417d3c838323f58ba9eeaa7188ef">spi_write_no_ss</a>(<span class="keyword">const</span> uint8_t* buf, uint8_t len);</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;uint8_t <a class="code" href="rf__spi_8h.html#af22734746aa8440e525d93dc5626b3f8">spi_read_no_ss</a>(uint8_t command, uint8_t nopChar, uint8_t* buf, uint8_t len);</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;<span class="keywordtype">void</span> <a class="code" href="rf__spi_8h.html#af40c9e8c67ebdfc55465a3503591465d">spi_ss</a>(<span class="keywordtype">bool</span> state);</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;<span class="preprocessor">#ifdef  __cplusplus</span></div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;}</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="preprocessor">#endif  </span><span class="comment">/* SPI_H */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div>
<div class="ttc" id="rf__spi_8h_html_a3a40417d3c838323f58ba9eeaa7188ef"><div class="ttname"><a href="rf__spi_8h.html#a3a40417d3c838323f58ba9eeaa7188ef">spi_write_no_ss</a></div><div class="ttdeci">uint8_t spi_write_no_ss(const uint8_t *buf, uint8_t len)</div><div class="ttdef"><b>Definition:</b> rf_spi.c:150</div></div>
<div class="ttc" id="rf__spi_8h_html_ae3f683d9d5b5d9542895dcbe0cb269b0"><div class="ttname"><a href="rf__spi_8h.html#ae3f683d9d5b5d9542895dcbe0cb269b0">spi_write</a></div><div class="ttdeci">uint8_t spi_write(uint8_t command, const uint8_t *buf, uint8_t len)</div><div class="ttdef"><b>Definition:</b> rf_spi.c:77</div></div>
<div class="ttc" id="rf__spi_8h_html_af22734746aa8440e525d93dc5626b3f8"><div class="ttname"><a href="rf__spi_8h.html#af22734746aa8440e525d93dc5626b3f8">spi_read_no_ss</a></div><div class="ttdeci">uint8_t spi_read_no_ss(uint8_t command, uint8_t nopChar, uint8_t *buf, uint8_t len)</div><div class="ttdef"><b>Definition:</b> rf_spi.c:122</div></div>
<div class="ttc" id="rf__spi_8h_html_a35736310ee6ad14f2aa1bfa3d62c61dd"><div class="ttname"><a href="rf__spi_8h.html#a35736310ee6ad14f2aa1bfa3d62c61dd">spi_init</a></div><div class="ttdeci">void spi_init(SPI_MODE mode, volatile uint16_t *SS_REG, uint8_t SS_pin)</div><div class="ttdef"><b>Definition:</b> rf_spi.c:14</div></div>
<div class="ttc" id="rf__spi_8h_html_af40c9e8c67ebdfc55465a3503591465d"><div class="ttname"><a href="rf__spi_8h.html#af40c9e8c67ebdfc55465a3503591465d">spi_ss</a></div><div class="ttdeci">void spi_ss(bool state)</div><div class="ttdef"><b>Definition:</b> rf_spi.c:39</div></div>
<div class="ttc" id="rf__spi_8h_html_a021d3d71d7de4dde682dd55fbc0c2e71"><div class="ttname"><a href="rf__spi_8h.html#a021d3d71d7de4dde682dd55fbc0c2e71">spi_write8</a></div><div class="ttdeci">uint8_t spi_write8(const uint8_t byte)</div><div class="ttdef"><b>Definition:</b> rf_spi.c:48</div></div>
<div class="ttc" id="rf__spi_8h_html_a098ee1e29d7d291d7d452729cccd7f51"><div class="ttname"><a href="rf__spi_8h.html#a098ee1e29d7d291d7d452729cccd7f51">spi_read</a></div><div class="ttdeci">uint8_t spi_read(uint8_t command, uint8_t nopChar, uint8_t *buf, uint8_t len)</div><div class="ttdef"><b>Definition:</b> rf_spi.c:100</div></div>
<div class="ttc" id="rf__spi_8h_html_af27e39df5f7f65da4878d5a3cfb1d830"><div class="ttname"><a href="rf__spi_8h.html#af27e39df5f7f65da4878d5a3cfb1d830">spi_write16</a></div><div class="ttdeci">uint16_t spi_write16(const uint16_t word)</div><div class="ttdef"><b>Definition:</b> rf_spi.c:63</div></div>
<div class="ttc" id="rf__spi_8h_html_afe4fa4827707bf89700f67434d84dd84"><div class="ttname"><a href="rf__spi_8h.html#afe4fa4827707bf89700f67434d84dd84">spi_write8_no_ss</a></div><div class="ttdeci">uint8_t spi_write8_no_ss(const uint8_t byte)</div><div class="ttdef"><b>Definition:</b> rf_spi.c:140</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Feb 20 2015 20:21:26 for RF24 Library for 16 bit PIC MCUs by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
